package jok.demo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateDemo {

	public static void main(String[] args) throws ParseException {
		
		Date date = new Date();
		
		System.out.println(date);		
		System.out.println(date.getTime());
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS E a");
		System.out.println(sdf.format(date));
		
		SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
		Date date2 = sdf2.parse("1988/05/12 23:08:27");
		System.out.println(date2);
		
		//GregorianCalendar
		Calendar ca = Calendar.getInstance();
		
		System.out.println(ca.get(Calendar.YEAR));
		System.out.println(ca.get(Calendar.DAY_OF_MONTH));
		System.out.println(ca.get(Calendar.HOUR_OF_DAY));
		
		ca.set(Calendar.MONTH, 3);
		System.out.println(ca.get(Calendar.MONTH));
	}
}
